<?php
namespace app\admin\controller;

use think\Db;
use think\Loader;
use think\Request;

class Set extends Base
{
    /**
     * 菜单管理
     */
    public function menu(Request $request)
    {
        if ($request->isPost())
        {
            $data = $request->post();
            $res = Db::name('admin_nav')->insert($data);
            if(!$res)
            {
                return ['status' => 0, 'msg' => '添加失败'];
            } else {
                return ['status' => 1, 'msg' => '添加成功'];
            }
        } else {
            $menuListArr=model('AdminNav')->getTreeData('tree','order_number,id');
            $assign=array(
                'menuListArr'=>$menuListArr
            );
            $this->assign($assign);
            return $this->fetch();
        }

    }

}
